package ccm.component.image;

import ccm.communicate.tcp.TcpClient;
import ccm.component.override.JFrame;

import java.awt.*;

public class ReceiveImageTest extends JFrame
{
    private static final String[] title=new String[]{"communicate","tcp","ReceiveImageTest"};
    protected TcpClient tcpClient;
    protected ImageDecoder imageDecoder;
    protected ImageJPanel imageJPanel;

    ReceiveImageTest()
    {
        super(title);
        setLayout(new BorderLayout());

        tcpClient=new TcpClient();
        imageDecoder=new ImageDecoder();
        tcpClient.addReceiveDataListener(imageDecoder);
        add(imageJPanel=new ManualResizeableImageJPanel());
        imageDecoder.addReceiveImageListener(imageJPanel);


        tcpClient.start();


    }

    public static void main(String[] args)
    {
        (new ReceiveImageTest()).setVisible(true);
    }

    public String[] getTitleArray()
    {
        return title;
    }
    @Override
    public void restart()
    {
        dispose();
        main();
    }

    public static void main()
    {
        main(new String[0]);
    }
}
